import { Component, OnInit, ViewChild } from '@angular/core';
import { masterService } from '../../../../lib/master.service';
import { ModalDirective } from 'ngx-bootstrap/modal';
import { PrepaidVoucherComponent } from './prepaid-voucher/prepaid-voucher.component';
import { GridComponent } from './grid-grade/grid.component';

@Component({
    selector: 'app-prepaid-voucher-management',
    templateUrl: './prepaid-voucher-management.component.html',
    styleUrls: ['./prepaid-voucher-management.component.css'],
    providers: [masterService]
})
export class PrepaidVoucherManagementComponent implements OnInit {
    @ViewChild('pvModal') pvModal: ModalDirective;
    @ViewChild('addForm') addForm: PrepaidVoucherComponent;
    @ViewChild('gridGrade') gridGrade: GridComponent;

    constructor() { }

    ngOnInit() { }

    closeModal(type?) {
        // 1为关闭按钮
        this.pvModal.hide();
        this.addForm.condition = {
            suGuid: '',
            amount: '',
            displayAmount: '',
            items: [],
            displayIndex: ''
        };
        this.addForm.rows = [ ];
        this.addForm.cdRef.detectChanges();
    }
}
